package com.test.daily.leetcode.y2021.m12.day1217;

/**
 * @author Tom on 2021/12/17
 */
public class Code01_NumWaterBottle {
    public static void main(String[] args) {
        Code01_NumWaterBottle cn = new Code01_NumWaterBottle();
        int numBottles = 15, numExchange = 4;
        System.out.println(cn.numWaterBottles(15, 4));
    }
    public int numWaterBottles(int numBottles, int numExchange) {
        int sum = numBottles;
        while(numBottles / numExchange > 0){
            int afterDrinks = (int) numBottles/numExchange;
            sum += afterDrinks;
            int mod = numBottles % numExchange;
            numBottles = mod + afterDrinks;
        }
        return sum;
    }
}
